home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / UTIL / Alpha 6.5.sit / Tcl / UserCode / listFuncs.tcl < prev    next >
Text File  |  1996-08-15  |  3KB  |  96 lines

  1. # FILE: listFuncs.tcl
  2. #
  3. # LAST UPDATE: 01/07/93 7:11:44 AM
  4. #
  5. # This file contains the following TCL procedure(s):
  6. #
  7. #     listFuncs -- returns a list of functions in the current window
  8. #
  9. #    Place cursor near the front of a language file (TCL or C) and
  10. #    execute it.
  11.  
  12. #    To use, simply source this file place it in the a folder with the
  13. #    name $HOME:Tcl:Usercode: and invoke it implicitly via the "unknown proc".
  14. #
  15. # SEE ALSO unknown.tcl
  16.  
  17. # COPYRIGHT:
  18. #
  19. #    Copyright ゥ 1992,1993 by David C. Black
  20. #    All rights reserved.
  21. #
  22. #    Redistribution and use in source and binary forms are permitted
  23. #    provided that the above copyright notice and this paragraph are
  24. #    duplicated in all such forms and that any documentation,
  25. #    advertising materials, and other materials related to such
  26. #    distribution and use acknowledge that the software was developed
  27. #    by David C. Black.
  28. #
  29. #    THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  30. #    IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  31. #    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  32. #
  33. ################################################################################
  34.  
  35. # AUTHOR
  36. #
  37. #    David C. Black
  38. #    Internet: black@mpd.tandem.com (preferred)
  39. #    GEnie:    D.C.Black
  40. #    USnail:   6217 John Chisum Lane, Austin, TX 78749
  41. #
  42. ################################################################################
  43.  
  44. # HISTORY
  45. #                  
  46. # modified who rev reason
  47. # -------- --- --- ------
  48. # 01/06/93 DCB 1.0 Original
  49.  
  50. # DESCRIPTION:
  51. #    listFuncs extracts a list of functions and inserts it
  52. #    (or replaces any current selection) in the current window.
  53. #    The extracted list is left selected.  This may then be used
  54. #    for documentation either in the current file or cut/pasted
  55. #    to elsewhere.  Also useful in conjunction with the 'canon'
  56. #    procedure.
  57. # USE:
  58. #    Simple invoke without arguments.
  59.  
  60. proc listFuncs {} {
  61.     global funcExpr
  62.     global funcPar
  63.     set patt $funcExpr
  64.     set funcExtr "¥¥$funcPar"
  65.     set listFuncs {}
  66.     set done 0
  67.     set pos 0
  68.     set max [maxPos]
  69.     while {!$done} {
  70.         set fp [search -f 1 -r 1 -i 0 -m 0 -n $patt $pos]
  71.         if {[llength $fp] == 2} {
  72.             set s [lindex $fp 0]
  73.             set e [lindex $fp 1]
  74.             set fn [getText $s [expr {$e}]]
  75.             regsub $patt $fn $funcExtr fn
  76.             lappend listFuncs $fn
  77.             set pos [nextLineStart $e]
  78.         } else {
  79.             set done 1
  80.             break
  81.         }
  82.     }
  83.     lappend listFuncs {}
  84.     set text [join $listFuncs "¥r"]
  85.     replaceText [getPos] [selEnd] $text
  86.     goto [expr {[getPos] + [string length $text]}]
  87.     markHilite
  88. }
  89. #endproc listFuncs.tcl
  90.  
  91. ################################################################################
  92.  
  93.